<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=request.getContextPath()%>/css/base.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.pager.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/base.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/admin.js"></script>
<title>推荐管理</title>
</head>

<BODY class=list><DIV class=bar>
<c:if test="${kind==1}">疯狂抢购</c:if>
<c:if test="${kind==2}">猜您喜欢</c:if>
<c:if test="${kind==3}">热卖商品</c:if>
<c:if test="${kind==4}">新品推荐</c:if>
&nbsp;总记录数: ${fn:length(groupGoodslist)}</DIV>
<DIV class=body>
<DIV class=listBar>
<INPUT hideFocus class=formButton onclick="showGoods()" value=添加推荐 type=button>
 &nbsp;&nbsp; 
</DIV>

<TABLE id=listTable class=listTable>
<TBODY>
<TR>

<TH><SPAN>商品名称</SPAN> </TH>
<TH><SPAN>销售价格</SPAN> </TH>
<TH><A hideFocus class=sort href="#" name=isMarketable >上架</A> </TH>
<TH><A hideFocus class=sort href="#" name=isBest>精品</A> </TH>
<TH><A hideFocus class=sort href="#" name=isNew>新品</A> </TH>
<TH><A hideFocus class=sort href="#" name=isHot>热销</A> </TH>
<TH><SPAN>库存</SPAN> </TH>
<TH><SPAN>排序</SPAN> </TH>
<TH><SPAN>状态</SPAN> </TH>
<TH><SPAN>操作</SPAN> </TH></TR>
<c:forEach items="${groupGoodslist}" var="groupgoods">
<TR id='${groupgoods.id}'>
<TD ><SPAN>${groupgoods.goods.goodsName} </SPAN></TD>
<TD>￥${groupgoods.goods.price}元</TD>
<TD><SPAN class=${groupgoods.goods.isMarketable==1?'trueIcon':'falseIcon'}>&nbsp;</SPAN> </TD>
<TD><SPAN class=${groupgoods.goods.isBest==1?'trueIcon':'falseIcon'}>&nbsp;</SPAN> </TD>
<TD><SPAN class=${groupgoods.goods.isNew==1?'trueIcon':'falseIcon'}>&nbsp;</SPAN> </TD>
<TD><SPAN class=${groupgoods.goods.isHot==1?'trueIcon':'falseIcon'}>&nbsp;</SPAN> </TD>
<TD>${groupgoods.goods.goodsNum}</TD>
<TD>${groupgoods.sort}</TD>
<TD>${groupgoods.status==1?'显示':'隐藏'}</TD>
<TD>
<SPAN class=upIcon title="上移">&nbsp;</SPAN>
<SPAN class=downIcon title="下移">&nbsp;</SPAN>
<c:if test="${groupgoods.status==1}">
<A title=隐藏 href="indexgroupstatus.do?id=${groupgoods.id}" >[隐藏]</A>
</c:if>
<c:if test="${groupgoods.status==0}">
<A title=显示 href="indexgroupstatus.do?id=${groupgoods.id}" >[显示]</A> 
</c:if>
<A title=删除 href="javascript:del('${groupgoods.id}')">[删除]</A> </TD>
</TR>
</c:forEach>

</TBODY></TABLE>
</DIV>

<DIV id="goodsSelect" style="Z-INDEX: 103; WIDTH: 800px; DISPLAY: none; HEIGHT: 400px; MARGIN-LEFT: -400px;top:5%"  class=baseDialog >
      <DIV class=dialogWrap></DIV>
      <DIV class=dialogMain>
        <div  class="dialogTitle" style="height:30px;line-height:35px">添加商品到
        <c:if test="${kind==1}">疯狂抢购</c:if>
		<c:if test="${kind==2}">猜您喜欢</c:if>
		<c:if test="${kind==3}">热卖商品</c:if>
		<c:if test="${kind==4}">新品推荐</c:if></div><DIV class=dialogClose onclick="hideGoods()"></DIV>
        <DIV style="padding:10px"><IFRAME height=345 frameborder="no"  src="goodsselect.do" width=750 align=center></IFRAME></DIV>
     </DIV>
</DIV>
</BODY>

<SCRIPT type=text/javascript>
function del(id)
{
  $.dialog({type: "warn", content: "您确定要删除吗?", ok: "确 定", cancel: "取 消", modal: true, okCallback: deleteAdv});
  function deleteAdv(){
    location.href='indexgroupdel.do?id='+id;
  }

}

function showGoods()
{
   $("#goodsSelect").show();
  }
function hideGoods()
{
  $("#goodsSelect").hide();
}
function closeGoods(ids)
{
  $("#goodsSelect").hide();
  location.href='indexgroupsave.do?ids='+ids+'&kind=${kind}';
}

$().ready( function() {
	
	$(".upIcon").bind('click',function(){
	   var tr=$(this).parent().parent();
	   var currentId=tr.attr("id");
	   var preId= tr.prev().attr("id");  
	   if(preId)
	   {
	    var url='<%=request.getContextPath()%>/admin/indexgroupsort.do?id='+currentId+'&targetid='+preId;
	    $.get(url,function(result){
            location.href='indexgrouplist.do?kind=${kind}';
          });   
	   }	
	})
	$(".downIcon").bind('click',function(){
	   var tr=$(this).parent().parent();
	   var currentId=tr.attr("id");
	   var nextId= tr.next().attr("id");  
	   if(nextId)
	   {
	    var url='<%=request.getContextPath()%>/admin/indexgroupsort.do?id='+currentId+'&targetid='+nextId;
	    $.get(url,function(result){
            location.href='indexgrouplist.do?kind=${kind}';
          });   
	   }	
	})

})
</SCRIPT>
</html>